package com.mianle.userapi.controller;

import com.mianle.userapi.util.JsonResponseData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class PublicController {

    private static final Logger log= LoggerFactory.getLogger(PublicController.class);

    @GetMapping("/public_tip/filter_error")
    public JsonResponseData<String> returnFilterError(HttpServletRequest request)
    {

        String msg = request.getAttribute("my_filter_exception").toString();
        Exception ex = (Exception) request.getAttribute("ex");
        if(ex!=null)
        {
            log.error(ex.getMessage(),ex);
        }
        return new JsonResponseData<>(2,msg,"");
    }
}
